/*
 * #%L
 * SwiftUIDataAccessLayer
 * $Id:$
 * $HeadURL:$
 * %%
 * Copyright (C) 2011 - 2012 Linkwithweb
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public 
 * License along with this program.  If not, see
 * <http://www.gnu.org/licenses/gpl-3.0.html>.
 * #L%
 */
/**
 * 
 */
package com.linkwithweb.products.swiftui.rowmapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.linkwithweb.products.swiftui.dataobject.FrameworkLOV;

/**
DROP TABLE IF EXISTS `automata`.`frm_lov`;
CREATE TABLE  `automata`.`frm_lov` (
  `LOV_KEY` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `LOV_ID` varchar(45) DEFAULT NULL,
  `ENTITY_ID` varchar(45) DEFAULT NULL,
  `LOV_NAME` varchar(45) DEFAULT NULL,
  `LOV_DESCRIPTION` varchar(45) DEFAULT NULL,
  `LOV_TYPE` varchar(45) DEFAULT NULL,
  `LOV_TABLE` varchar(45) DEFAULT NULL,
  `LOV_SQL` varchar(45) DEFAULT NULL,
  `LOV_KEY_COLUMN` varchar(45) DEFAULT NULL,
  `LOV_VALUE_COLUMN` varchar(45) DEFAULT NULL,
  `LOV_LABEL` varchar(45) DEFAULT NULL,
  `IS_ACTIVE` tinyint(1) NOT NULL,
  `IDENTIFIER` varchar(45) DEFAULT NULL,
  `IDENTIFIER_ROLE` varchar(45) DEFAULT NULL,
  `CREATED_BY` int(10) unsigned NOT NULL,
  `CREATED_DATE` datetime NOT NULL,
  `MODIFIED_BY` int(10) unsigned NOT NULL,
  `MODIFIED_DATE` datetime NOT NULL,
  PRIMARY KEY (`LOV_KEY`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 * 
 * @author ashwin kumar
 *
 */
public class LOVRowMapper extends AbstractRowMapper {

	/* (non-Javadoc)
	 * @see org.springframework.jdbc.core.RowMapper#mapRow(java.sql.ResultSet, int)
	 */
	public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
		FrameworkLOV lov = new FrameworkLOV();
		lov.setLovKey(rs.getLong("LOV_KEY"));
		lov.setLovDescription(rs.getString("LOV_DESCRIPTION"));
		lov.setLovID(rs.getString("LOV_ID"));
		lov.setLovKeyColumn(rs.getString("LOV_KEY_COLUMN"));
		lov.setLovLabel(rs.getString("LOV_LABEL"));
		lov.setLovName(rs.getString("LOV_NAME"));
		lov.setLovSQL(rs.getString("LOV_SQL"));
		lov.setLovTable(rs.getString("LOV_TABLE"));
		lov.setLovType(rs.getString("LOV_TYPE"));
		lov.setLovValueColumn(rs.getString("LOV_VALUE_COLUMN"));
		lov.setLovMode(rs.getString("LOV_MODE"));
		
		return mapDefaultColumns(lov,rs);
	}

}
